package com.ruoyi.video.controller;

import com.ruoyi.video.pojo.VideoEntity;
import com.ruoyi.video.result.Result;
import com.ruoyi.video.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * Description: new java files header..
 *
 * @author 兰剑
 * @version 1.0
 * @date 2023/2/28 10:29
 */
@RestController
@RequestMapping("/video")
public class VideoController {


    @Autowired
    private VideoService videoService;

    /**@Description: 分页查询+基本查询
     * @param videoEntity
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/2/27 11:28
     */
    @PostMapping("/list")
    public Map<String,Object> list(@RequestBody VideoEntity videoEntity){
        return videoService.list(videoEntity);
    }

    /**@Description: 添加视频
     * @param  videoEntity
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/2/27 11:24
     */
    @PostMapping("/addVideo")
    public Result addVideo(@RequestBody VideoEntity videoEntity){
        return videoService.addVideo(videoEntity);
    }

    /**@Description: 修改视频信息
     * @param videoEntity
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/2/27 11:26
     */
    @PostMapping("/updateVideo")
    public Result updateVideo(@RequestBody VideoEntity videoEntity){
        return videoService.updateVideo(videoEntity);
    }


    /**@Description: 视频删除
     * @param vid
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/2/27 11:29
     */
    @PostMapping("/del")
    public Result delVideo(@RequestParam("vid") Integer vid){
        return videoService.delVideo(vid);
    }

    /**@Description: 批量删除
     * @param vids
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/2/27 11:31
     */
    @PostMapping("/delAllVideo")
    public Result delAllVideo(@RequestParam("vids") String vids){
        return videoService.delAllVideo(vids);
    }


    /**@Description: 逻辑删除
     * @param videoEntity
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/2/27 11:37
     */
    @PostMapping("/deleteVideo")
    public Result deleteVideo(@RequestBody VideoEntity videoEntity){
        return videoService.deleteVideo(videoEntity);
    }


    /**@Description: 审核状态
     * @param videoEntity
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/2/27 16:25
     */
    @PostMapping("/examineStatus")
    public Result examineStatusUp(@RequestBody VideoEntity videoEntity){
        return videoService.examineStatusUp(videoEntity);
    }

    /**@Description: 审核驳回
     * @param videoEntity
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/2/27 16:25
     */
    @PostMapping("/examineStatusEnd")
    public Result examineStatusEnd(@RequestBody VideoEntity videoEntity){
        return videoService.examineStatusEnd(videoEntity);
    }


    /**@Description: 上传视频
     * @param file
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/3/1 18:24
     */
    @PostMapping("/uploadVideo")
    public String uploadVideo(@RequestParam (value = "file",required = true) MultipartFile file) throws Exception{

        return null;
    }
}
